
void InitExpTree(BTree &T,string str)
{
	stack<BTree>t;
	stack<char>q;
	q.push('#');
	int j=0;
	while(str[j])
	{
		if(!In(str[j]))
		{
		 T=new BTNode;
	 	 T->data=str[j];
	 	 j++;
		 T->lchild=T->rchild=NULL;
		 t.push(T);	
		}
		else
	 {
	 	switch(Precede(q.top(),str[j]))
	 	{
	 		case'<':
	 			q.push(str[j]);
	 			j++;
	 			break;
	 		case'=':
	 			q.pop();
	 			j++;
	 			break;
	 		case'>':
	 			T=new BTNode;
	 			T->data=q.top();
	 			T->rchild=t.top();
				 t.pop();
				 T->lchild=t.top();
				 t.pop();
				 t.push(T);
				 q.pop();
				 break; 
	 	}
	 }
	}
	 while(q.top()!='#')
	 {
	 	T=new BTNode;
	 	T->data=q.top();
	 	T->rchild=t.top();
	 	t.pop();
	 	if(!t.empty())
	 	{
	 		T->lchild=t.top();
	 		t.pop();
	 	}
	 	t.push(T);
	 	q.pop();
	 }
	 T=t.top();
}
double EvaluateExTree(BTree T)
{
	double sum=0,x,y;
	if(!T->lchild&&!T->rchild)
	{
		return T->data-'0';
	}
	x=EvaluateExTree(T->lchild);
	y=EvaluateExTree(T->rchild);
	switch(T->data)
	{
		case '+':
			return x+y;
			break;
		case '-':
			return x-y;
			break;
		case '*':
		    return x*y;
			break;
		case '/':
		    if(y-1&&y<1)
			{
				cout<<"divide 0 error!"<<endl;
				exit(0);
			}
			return x/y;
			break;
	}
}
